var selectUsers;
var selectUsersCellfuncs = [function(data) {
			return data.username;
		}, function(data) {
			return data.name;
		}, function(data) {
			return data.state == '1' ? '有效' : '无效';
		}/*, function(data) {
			var href = document.createElement('a');
			href.setAttribute('href', '#');
			href.onclick = function() {
				if (selectUsers.type == "dept") {
					if (confirm('确认将用户(' + data.username + ')从此组织机构移除吗?')) {
						Dept.removeByUserUUIDDeptid(data.useruuid,selectUsers.id,
								 function(data) {
									if (data == 1) {
										send(selectUsers);
										alert("移除成功！")
									} else {
										alert("移除失败！")
									}
								});
					};
				} else if (selectUsers.type == "role") {
					if (confirm('确认移除用户(' + data.username + ')的此角色吗?')) {
						Role.removeByUserUUIDRoleid(data.useruuid,selectUsers.id,
								 function(data) {
									if (data == 1) {
										send(selectUsers);
										alert("移除成功！")
									} else {
										alert("移除失败！")
									}
								});
					};
				}
			};
			href.innerHTML = '移除';
			return href;
		}*/];
var userSelectDialog = new Dialog({
			showdiv : "userSelectDialog",
			title : "用户列表",
			x : 500,
			y : 500
		});
rootDialog.childDialog = userSelectDialog;
function initSelectUsers(id, type) {
	userSelectDialog.showdivWidth = 500;
	userSelectDialog.showdivHeight = 500;
	userSelectDialog.title = "用户列表";
	openDialog(userSelectDialog, '', function() {
				var chakantable = document.createElement("table");
				chakantable.style.align = "center";
				chakantable.className = "table";
				userSelectDialog.contentdiv.appendChild(chakantable);
				var chakanthead = document.createElement("<thead>");
				chakanthead.setAttribute('id', 'theadzone');
				chakantable.appendChild(chakanthead);
				var chakantr = document.createElement("<tr>");
				chakantr.setAttribute("id", "tou");
				chakanthead.appendChild(chakantr);
				var chakanth1 = document.createElement("<td>");
				chakantr.appendChild(chakanth1);

				var chakanth2 = document.createElement("<td>");
				chakantr.appendChild(chakanth2);

				var chakanth5 = document.createElement("<td>");
				chakantr.appendChild(chakanth5);

				//var chakanth6 = document.createElement("<td>");
				//chakantr.appendChild(chakanth6);

				chakanth1.innerHTML = "<nobr><b>用户名</b></nobr>";
				chakanth2.innerHTML = "<nobr><b>姓名</b></nobr>";
				chakanth5.innerHTML = "<nobr><b>有效标志</b></nobr>";
				//chakanth6.innerHTML = "<nobr><b>移除</b></nobr>";

				var chakantbody = document.createElement("tbody");
				chakantbody.setAttribute('id', 'selectUserslistZone_data');
				chakantable.appendChild(chakantbody);
				var chakantfoot = document.createElement("div");
				chakantfoot.setAttribute('id', 'selectUserslistZone_bar');
				userSelectDialog.contentdiv.appendChild(chakantfoot);

				if (type == "dept") {
					selectUsers = {
						navigationsize : 10,
						paramname : 'selectUsers',
						page : 1,
						funcname : 'Dept.findAllUserPageByDept(\'' + id
								+ '\',)',
						cellfuncs : selectUsersCellfuncs,
						pagesize : 10,
						count : 'findAllUserPageByDeptGetCount(\'' + id
								+ '\',)',
						idname : 'selectUserslistZone'
					};
					selectUsers.id = id;
					selectUsers.type = type;
					send(selectUsers);
				} else if (type == "role") {
					selectUsers = {
						navigationsize : 10,
						paramname : 'selectUsers',
						page : 1,
						funcname : 'Role.findAllUserPageByRole(\'' + id
								+ '\',)',
						cellfuncs : selectUsersCellfuncs,
						pagesize : 10,
						count : 'findAllUserPageByRoleGetCount(\'' + id
								+ '\',)',
						idname : 'selectUserslistZone'
					};
					selectUsers.id = id;
					selectUsers.type = type;
					send(selectUsers);
				}
			});
}